package com.achobeta.recruitment.config;

import com.achobeta.recruitment.component.interceptor.ForceInterceptor;
import com.achobeta.recruitment.component.interceptor.ManagerInterceptor;
import com.achobeta.recruitment.component.interceptor.UserInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 马拉圈
 * Date: 2023-10-06
 * Time: 12:56
 */
@Configuration//不是Configurable！
public class VisitConfig implements WebMvcConfigurer {

    @Resource
    private UserInterceptor userInterceptor;//自定义的登录拦截器

    @Resource
    private ManagerInterceptor managerInterceptor;


    @Resource
    private ForceInterceptor forceInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userInterceptor)
                // 反馈相关
                .addPathPatterns("/feedback/submit")
                // 用户信息相关
                .addPathPatterns("/studentinfo/picture")
                .addPathPatterns("/studentinfo/save")
                .addPathPatterns("/studentinfo/select")
                .addPathPatterns("/studentinfo/submit")
                // 微信用户相关
                .addPathPatterns("/wxuser/check")
                // 消息相关
                .addPathPatterns("/message/detail")
                //附件相关
                .addPathPatterns("/attachment/delete")
                .addPathPatterns("/attachment/list")
                .addPathPatterns("/attachment/submit")
        ;
        registry.addInterceptor(managerInterceptor)
                // 反馈相关
                .addPathPatterns("/feedback/count")
                .addPathPatterns("/feedback/list")
                .addPathPatterns("/feedback/read")
                // 用户信息相关
                .addPathPatterns("/studentinfo/detail")
                .addPathPatterns("/studentinfo/modify")
                .addPathPatterns("/studentinfo/manager/picture")
                // 用户相关
                .addPathPatterns("/student/states")
                .addPathPatterns("/student/list")
                // 消息相关
                .addPathPatterns("/message/mass")
                .addPathPatterns("/message/send")
                .addPathPatterns("/message/picture")
                .addPathPatterns("/message/list")
                // 管理员给用户标注相关
                .addPathPatterns("/remarks/save")
                // 管理员相关
                .addPathPatterns("/manager/check")
                // 附件相关
                .addPathPatterns("/attachment/manager/list")
                // 配置相关
                .addPathPatterns("/config/virtual")
                .addPathPatterns("/config/save")
                .addPathPatterns("/config/model")
                .addPathPatterns("/config/home")
                .addPathPatterns("/config/deliver")
        ;
//        registry.addInterceptor(forceInterceptor)
//                // swagger相关
//                .addPathPatterns("/swagger-ui/**")
//                .addPathPatterns("/swagger-ui.html")
//                .addPathPatterns("/configuration/ui/**")
//                .addPathPatterns("/swagger-resources/**")
//                .addPathPatterns("/configuration/security/**")
//                .addPathPatterns("/v2/api-docs/**")
//                .addPathPatterns("/v3/api-docs/**")
//                .addPathPatterns("/error/**")
//                .addPathPatterns("/webjars/**")
//                // 微信用户相关
//                .addPathPatterns("/wxuser/login")
//        ;
    }


}
